﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Cybertron_Tracker.Cybertron
{
    public class Project
    {
        public String name;
        public DateTime date;
        public Hashtable issues;
        public String link;
        public String id;

        public Project()
        {
            
        }

        public void setName(String p)
        {
            /*int nameBegin = p.IndexOf("Project: ")+9;
            name = Html.Decode( p.Substring(nameBegin, p.Length - nameBegin) );*/
            name = Html.Decode(p);
        }

        public void setLink(String l)
        {
            int beginId = l.IndexOf("/projects/show/") + 15;
            id = l.Substring(beginId, l.Length - beginId);
            link = l;
        }

        public void setId(String i)
        {
            id = i;
        }

        public void setDate(String dateString)
        {
            date = DateTime.Parse(dateString);
        }

        public void clearIssues()
        {
            if (issues == null) issues = new Hashtable();
            else issues.Clear();
        }

        public void addIssue(Issue issue)
        {
            issues.Add(issue.name, issue);
        }

        public void getIssues()
        {

        }
    }
}
